from enum import Enum
from enum import IntEnum as SourceIntEnum
from typing import Type

class _EnumBase:
    @classmethod
    def get_member_keys(cls: Type[Enum]) -> list[str]:
        return [name for name in cls.__members__.keys()]

    @classmethod
    def get_member_values(cls: Type[Enum]) -> list:
        return [item.value for item in cls.__members__.values()]


class IntEnum(_EnumBase, SourceIntEnum):
    """整型枚举"""

    pass


class StrEnum(_EnumBase, str, Enum):
    """字符串枚举"""

    pass


class CONTENT_TYPE(StrEnum):
    DOC = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
    DOCX = DOC
    PDF = 'application/pdf'
    
    def get_content_type(ftype: str):
        if ftype in ["doc", "docx", "DOC", "DOCX"]:
            return CONTENT_TYPE.DOC.value
        elif ftype in ["PDF", "pdf"]:
            return CONTENT_TYPE.PDF.value
        else:
            return None
        
class MethodType(StrEnum):
    GET = "GET"
    POST = "POST"
    PUT = "PUT"
    DELETE = "DELETE"
    PATCH = "PATCH"